#ifndef WAIT_TIME_FUNC_H
#define WAIT_TIME_FUNC_H

#include "main.h"
#include "configs.h"

#define MAX_WAIT_FUNC_NUM 20

typedef struct{
	bool (*func)(void*);
	uint16_t now_exec_time;
	uint16_t max_wait_ms;
}Func_Module;

typedef struct{
	Func_Module wait_funcs[MAX_WAIT_FUNC_NUM];
	uint8_t now_num;
}Func_Manager;

extern Func_Manager func_manager;

void REGISTER_FUNC(bool (*func)(void*), uint16_t max_wait_time);
void EXECUTE_ALL_FUNCS(void *param);
bool UNREGISTER_FUNC(bool (*func)(void*));
bool UNREGISTER_FUNC_BY_INDEX(uint8_t index);

#endif
